<?php
require_once "../database/mysql.class.php";
//DAO对象，对数据库操作
//对应用户表，用户的增删改查

class jiekousetdao{

	private $db;

	public function __construct(){
		$this->db=new mysql();
	}
	
	public function Chaxun($jiekousetid=null){	
		if (!isset($jiekousetid)){
			$sql="select * from chzhijk order by id;";
			return $this->db->query($sql);
		}
		else if (isset($jiekousetid)){
			$sql="select *  from chzhijk  where id like '{$jiekousetid}%' order by id;";
		    return $this->db->query($sql);
		}
		else {
			
		}
	}
	//添加
	public function Tian($ming,$zhang){
		$sql=" INSERT INTO chzhijk VALUES(null,'".$ming."','".$zhang."');";
			return $this->db->inser($sql);
			header("location:../view/main.php?url=jiekouset.php");
		
	}
	//修改
	public function Xiugai($jiekousetid,$zhang){
		if (isset($zhang)){
			$sql=" UPDATE  chzhijk SET ruzhang='".$zhang."' WHERE id=".$jiekousetid.";";
			return $this->db->update($sql);
			header("location:../view/main.php?url=jiekouset.php");
		}
	
	}
	
}
?>